package tt.dz.egobus.servicemanager.controller.driverbusrelative;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import tt.dz.egobus.bean.CriteriaRestrictionsBuilder;
import tt.dz.egobus.servicemanager.base.controller.EntityController;
import tt.dz.egobus.servicemanager.base.service.ExtendBaseService;
import tt.dz.egobus.servicemanager.entities.DriverRegisterBusRelative;
import tt.dz.egobus.servicemanager.service.DriverRegisterBusRelativeService;
import tt.dz.egobus.servicemanager.vo.DriverRegisterBusRelativeViewVo;
import tt.dz.egobus.servicemanager.vo.JsonBack;

import javax.validation.Valid;

import static tt.dz.egobus.servicemanager.bean.ServiceManagerCodeStatus.SERVICE_IS_NO_SUPPORT;

/**
 * @author Anson
 * @date 17-8-24
 * @name 司机车辆绑定关系查询模块
 * @since 1.0.6
 */
@RestController
@RequestMapping("/driverBusRelative")
public class DriverBusRelativeController extends EntityController<DriverRegisterBusRelative,
        DriverRegisterBusRelativeViewVo, String> {
    private static final Logger LOGGER = LoggerFactory.getLogger(DriverBusRelativeController.class);

    @Autowired
    @Qualifier("driverRegisterBusRelativeServiceImpl")
    private DriverRegisterBusRelativeService service;

    @Override
    protected ExtendBaseService<DriverRegisterBusRelative, String> getSelfService() {
        return this.service;
    }

    @Override
    protected DriverRegisterBusRelativeViewVo newViewVo() {
        return new DriverRegisterBusRelativeViewVo();
    }

    /**
     * @param v 新增
     * @author Anson
     * @date 17-3-14
     * @name 新增参数
     * @see CriteriaRestrictionsBuilder
     * @since 1.0.1
     */
    @RequestMapping("/insert")
    public JsonBack<DriverRegisterBusRelativeViewVo> insert(@ModelAttribute @Valid DriverRegisterBusRelativeViewVo v,
                                                            BindingResult result) {
        return JsonBack.error(SERVICE_IS_NO_SUPPORT);
    }


    /**
     * @param v 更新参数
     * @author Anson
     * @date 17-3-14
     * @name 更新
     * @see CriteriaRestrictionsBuilder
     * @since 1.0.1
     */
    @RequestMapping("/update")
    public JsonBack<DriverRegisterBusRelativeViewVo> update(@ModelAttribute @Valid DriverRegisterBusRelativeViewVo v,
                                                            BindingResult result) {
        return JsonBack.error(SERVICE_IS_NO_SUPPORT);
    }

    /**
     * @param id 删除
     * @author Anson
     * @date 17-3-14
     * @name 删除
     * @see CriteriaRestrictionsBuilder
     * @since 1.0.1
     */
    @RequestMapping("/delete")
    public JsonBack<String> delete(@RequestParam("id") String id) {
        return JsonBack.error(SERVICE_IS_NO_SUPPORT);
    }
}
